function test_char() {
    const charCodeArr: number[] = [
        65, 66, 67, 68, 69, 0, 0, 0, 0, 0
    ]

    const s1 = charCodeArr.toLocaleString()
    const s2 = charCodeArr.toString()
    const s3 = charCodeArr.concat()

    console.log(s1)
    console.log(s2)
    console.log(s3)

    const unitA = new Uint8Array(charCodeArr)
    const s4 = unitA.toString()
    console.log(s4)

    let s5 = ""
    for (let i = 0; i < charCodeArr.length; i++) {
        s5 += String.fromCharCode(charCodeArr[i]);
    }
    console.log("[" + s5 + "]", "s5.length=" + s5.length)

    s5 = s5.trim()
    console.log("[" + s5 + "]", "s5.length=" + s5.length)

    const s6 = "abcde"
    console.log("abcde.length=" + s6.length)

    const unitB = new Uint8Array(charCodeArr);
    const s7 = new TextDecoder("utf-8").decode(unitB)
    console.log("s7.length=" + s7.length)
}

function test_gbk() {
    const s1 = "abcdef";
    const s2 = "abc哇哈哈";

    console.log("s1.length=", s1.length)
    console.log("s2.length=", s2.length)

    const u2 = []
    for (let i = 0; i < s2.length; i++) {
        u2.push(s2.charCodeAt(i))
    }
    console.log("u2=", u2)
}

function test_split() {
    const s1 = "a,b,c,d,e"

    console.log(1, s1.split(","))
    console.log(2, s1.split(",", 1))
    console.log(3, s1.split(",", 2))

    console.log(4, s1.split(/,/g))
    console.log(5, s1.split(/(,)/g))
    console.log(6, s1.split(/,/))
    console.log(7, s1.split(/,(.+)/))
    console.log(7, s1.split(/,(.+)/, 2))
    console.log(8, s1.split(/,()/g, 1))
    console.log(9, s1.split(/,(.+)/g), 1)
    console.log(10, s1.split(/(),()/g))
}

function test_substring() {
    const s1 = "a,b,c,d,e"

    const res1 = s1.substring(1)

    console.log(s1, res1)
}

function test_slice() {
    const s1 = "a,b,c,d,e"
    console.log(s1.slice(1, 2))
    console.log(s1.slice(1))
}

export function test_string() {
    console.log("===> test_string()")
    // test_char()
    // test_gbk()
    test_split()
    // test_substring()
    // test_slice()
}